package com.duanjw.springcloud.seata.consumer.web;

import com.duanjw.springcloud.seata.consumer.service.UserService;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author duanjw
 */
@RestController
@RequestMapping("user")
public class UserController {
    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    /**
     * 根据id删除用户
     * curl -X DELETE localhost:7005/user/1
     * @param id
     * @return
     */
    @DeleteMapping("{id}")
    public boolean deleteById(@PathVariable Integer id) {
        userService.deleteById(id);
        return true;
    }
}
